/* eslint-disable @typescript-eslint/no-explicit-any */
/*
 *  Copyright 2021 Collate
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *  http://www.apache.org/licenses/LICENSE-2.0
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

 /**
 * 此模式定义用于在两个实体之间建立关系的EntityRelationship类型，EntityRelationship用于捕获从一个实体到另一个实体的关系。例如，数据库包含表。
 */
export interface EntityRelationship {
    /**
     * `true`表示该关系已被软删除
     */
    deleted?: boolean;
    /**
     * 关系源自的实体的类型。示例：`database`、`table`、`metric`…
     */
    fromEntity: string;
    /**
     * 关系来源实体的完全限定名称
     */
    fromFQN?: string;
    /**
     * 标识关系源自的实体的唯一标识符
     */
    fromId?: string;
    /**
     * 将两个实体之间的关系描述为一个整数
     */
    relation?: number;
    /**
     * 描述两个实体之间的关系。例如：数据库---包含-->表
     */
    relationshipType: RelationshipType;
    /**
     * 关系所指向的实体的类型。示例：`database`、`table`、`metric`…
     */
    toEntity: string;
    /**
     * 关系所指向的实体的完全限定名称
     */
    toFQN?: string;
    /**
     * 标识关系所指向的实体的唯一标识符
     */
    toId?: string;
}

/**
 * 描述两个实体之间的关系。例如：数据库---包含-->表
 *
 * 此枚举捕获目录实体之间的所有关系，请注意，从的关系为强实体，到的关系尽可能为弱实体。
 */
export enum RelationshipType {
    AddressedTo = "addressedTo",
    AppliedTo = "appliedTo",
    Contains = "contains",
    CreatedBy = "createdBy",
    DefaultsTo = "defaultsTo",
    EditedBy = "editedBy",
    Expert = "expert",
    Follows = "follows",
    Has = "has",
    IsAbout = "isAbout",
    JoinedWith = "joinedWith",
    MentionedIn = "mentionedIn",
    Owns = "owns",
    ParentOf = "parentOf",
    ReactedTo = "reactedTo",
    RelatedTo = "relatedTo",
    RepliedTo = "repliedTo",
    Reviews = "reviews",
    TestedBy = "testedBy",
    Upstream = "upstream",
    Uses = "uses",
    Voted = "voted",
}
